package cn.yuanqiao.archive.qzj.service.impl;

import cn.yuanqiao.archive.qzj.domain.YqdaQzjInfo;
import cn.yuanqiao.archive.qzj.mapper.YqdaQzjInfoMapper;
import cn.yuanqiao.archive.qzj.service.YqdaQzjInfoService;
import cn.yuanqiao.common.utils.SecurityUtils;
import cn.yuanqiao.common.utils.SnowflakeIdGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class YqdaQzjInfoServiceImpl implements YqdaQzjInfoService {

    @Autowired
    private YqdaQzjInfoMapper yqdaQzjInfoMapper;

    @Override
    public int insertYqdaQzjInfo(YqdaQzjInfo yqdaQzjInfo) {
        if( yqdaQzjInfo.getId() != null){
            yqdaQzjInfo.setId(yqdaQzjInfo.getId());

        }else{
            yqdaQzjInfo.setId(SnowflakeIdGenerator.generateId());

        }
        yqdaQzjInfo.setTenantCode(SecurityUtils.getTenantCode());
        yqdaQzjInfo.setIsDel(0);
        return yqdaQzjInfoMapper.insertYqdaQzjInfo(yqdaQzjInfo);
    }

    @Override
    public int updateYqdaQzjInfo(YqdaQzjInfo yqdaQzjInfo) {
        return yqdaQzjInfoMapper.updateYqdaQzjInfo(yqdaQzjInfo);
    }

    @Override
    public int del(Long[] ids) {
        return yqdaQzjInfoMapper.del(ids);
    }

    @Override
    public List<YqdaQzjInfo> selectList(YqdaQzjInfo yqdaQzjInfo) {
        return yqdaQzjInfoMapper.selectList(yqdaQzjInfo);
    }
    @Override
    public List<YqdaQzjInfo> selectList1(YqdaQzjInfo yqdaQzjInfo) {
        return yqdaQzjInfoMapper.selectList1(yqdaQzjInfo);
    }
    @Override
    public YqdaQzjInfo getById(Long id) {
        return yqdaQzjInfoMapper.getById(id);
    }
}
